<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>统计管理</title>
		<script src="dep/modjs/mod.js"></script>
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css" />
		<link rel="stylesheet" type="text/css" href="css/dashboard.css" />
		<link rel="stylesheet" href="dep/datapicker/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" media="all" href="dep/datapicker/daterangepicker-bs3.css" />
		<style type="text/css">
			#statisticSearch .form-control {
				display: inline;
				width: 15%;
			}
		</style>
	</head>

	<body id="nav">
		<!-- 头部 -->
		<div class="container-fluid">
			<div class="row">
				<!-- 导航 -->
				<div class="col-sm-3 col-md-1 sidebar" id="sidebar">
				</div>
				<!-- 内容 -->
				<div class="col-sm-9 col-sm-offset-1 col-md-11 main">
					<h1 class="page-header">统计管理</h1>
					<div class="panel panel-default" style="overflow-x: auto;">
						<div class="panel-body clearfix">
							<div class="btn-group pull-right">
								<form id="statisticSearch" action="javascript:;">
									<div class="control-group">
										<div class="controls">
											<div class="input-prepend input-group">
												<span class="add-on input-group-addon"><i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span><input type="text" readonly style="width: 200px" name="reservation" id="reservation" class="form-control">
												<select name="customsDeclarationStatus" id="customsDeclarationStatus" class="form-control">
													<option value="">全部</option>
													<option value="0">预定</option>
													<option value="1">已报检</option>
													<option value="2">海关查验</option>
													<option value="3">放行</option>
												</select>
												<button type="submit" class="btn btn-success">搜索</button>
												<button type="button" class="btn btn-primary" id="print" data-toggle="modal" data-target="#printModel">打印</button>
											</div>
										</div>
									</div>
								</form>
							</div>
						</div>
						<!-- 表格 -->
						<div class="table-scrollable" id="table">

						</div>
					</div>
				</div>
			</div>
		</div>

		<!--打印-->
		<div class="modal fade" id="printModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		</div>
		<!--修改密码modal-->
		<div class="modal fade" id="editPasswordModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		</div>

		<script src="api-conf.js"></script>
		<script src="components/jquery/jquery.js"></script>
		<script src="dep/bootstrap/bootstrap.min.js"></script>
		<script src="src/common/tool.js"></script>
		<script src="dep/handlebars/handlebars.runtime-v3.0.3.js"></script>
		<script src="dep/jqPaginator/jqPaginator.js"></script>
		<script src="dep/datapicker/moment.js"></script>
		<script src="dep/datapicker/daterangepicker.js"></script>
		<script type="text/javascript">
			require('nav');
			require('sidebar');
			require('statisticsManage');

			$(document).ready(function() {
				$('#reservation').daterangepicker(null, function(start, end, label) {
					console.log(start.toISOString(), end.toISOString(), label);
				});
			});

			function printExcel() {
				var obj = document.getElementsByName("boxes");
				var check_val = '';
				var count = 0;
				for(var k in obj) {
					if(obj[k].checked) {
						check_val += obj[k].value + ',';
						count++;
					}
				}

				if(count == 0) {
					alert('请至少选中一项数据！');
					return false;
				} else {
					check_val = check_val.substring(0, check_val.length - 1)
					var start = $('#reservation').val().substring(0, 10).replace(/-/g, '/');
					var end = $('#reservation').val().substring(13).replace(/-/g, '/');

					if(!start) {
						
						var formatDate = function(date) {
							var y = date.getFullYear();
							var m = date.getMonth() + 1;
							m = m < 10 ? '0' + m : m;
							var d = date.getDate();
							d = d < 10 ? ('0' + d) : d;
							return y + '/' + m + '/' + d;
						};
						
						var firstDate = new Date();
						firstDate.setDate(1); //第一天
						var endDate = new Date(firstDate);
						endDate.setMonth(firstDate.getMonth() + 1);
						endDate.setDate(0);
						
						start = formatDate(firstDate);
						end = formatDate(endDate);
					}
					$('#choose').val(check_val);
					$('#startDate').val(start);
					$('#endDate').val(end);		
					
					var exp = $('#customsDeclarationStatus option:selected').val();
					if (!exp){
						console.info('不传东西');			
					}else{
						console.info('传东西');
						$('#customsDeclarationStatus1').val(exp);
					}　			
					return true;
				}
			}
		</script>
	</body>

</html>